﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bubble_Sort
{
    public class BubbleSort
    {
        int[] arr;

        public int[] IntArray {  get{return arr; } }

        public BubbleSort(int[] UnSortedArray){ arr = UnSortedArray; }

        public void Sort()
        {
            int temp;

            for (int i = arr.Length - 1; i >= 0; i--)
            {
                for (int j = 1; j <= i; j++)
                {
                    if (arr[j - 1] > arr[j])
                    {
                        temp = arr[j - 1];
                        arr[j - 1] = arr[j];
                        arr[j] = temp;
                    }
                }
            }
            
        }
    }
}
